﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DelonixRegiaHMSys.Core.Services;
using DelonixRegiaHMSys.Infrastructure.Data;



namespace DelonixRegiaHMSys.UI.WebForms
{
    public partial class CheckIn : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            lblguestID.Text = Request.QueryString["Guest ID"];
            lblreservationID.Text = Request.QueryString["Reservation ID"];
            lbluserID.Text = Request.QueryString["User ID"];
            lblcheckintime.Text = Request.QueryString["Check in Date Time"];
            lblcheckintime.Text = Convert.ToString(DateTime.Now);
        }

        protected void btncinext_Click(object sender, EventArgs e)
        {
            string CheckInID = lblcheckinID.Text;
            string GuestID = lblguestID.Text;
            string ReservationID = lblreservationID.Text;
            string UserID = lbluserID.Text;
            int NumberOfAdults = Convert.ToInt32(ddlnumOfAdults.SelectedValue);
            int NumberOfChildren = Convert.ToInt32(ddlnumOfChildren.SelectedValue);
            DateTime CheckInDateTime = Convert.ToDateTime(lblcheckintime.Text);
            DateTime DesiredCheckOutDateTime = Convert.ToDateTime(tbxdesirecheckouttime.Text);
            string RoomType = cblroomType.SelectedValue;
            string BedType = rblbedType.SelectedValue;
            string SmokingOrNot = rblsmokingOrNot.SelectedValue;
            string LateCheckOutReq = rbllateCheckOutReq.SelectedValue;
            int RoomNum = Convert.ToInt32(ddlroomNum.SelectedValue);
            string PaymentMode = cblpaymentMode.Text;
            string AddRemarks = tbxaddRemarks.Text;

            var ciservice = new ciServices(new EfCheckInQuery());
            ciservice.AddCheckIn(CheckInID, GuestID, ReservationID, UserID, NumberOfAdults, NumberOfChildren, CheckInDateTime, DesiredCheckOutDateTime, RoomType, BedType, SmokingOrNot,AddRemarks, LateCheckOutReq, RoomNum, PaymentMode);
            Response.Redirect("~/WebForms/RetrieveCheckIn.aspx", true);
        }
    }
}